/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.DeliverySender;
import org.apache.ibatis.jdbc.SQL;

public class DeliverySenderSqlProvider {

    /* @mbggenerated */
    public String insertSelective(DeliverySender record) {
        return new SQL() {
            {
                INSERT_INTO("delivery_sender");

                if (record.getUserId() != null) {
                    VALUES("user_id", "#{userId,jdbcType=INTEGER}");
                }

                if (record.getSenderName() != null) {
                    VALUES("sender_name", "#{senderName,jdbcType=VARCHAR}");
                }

                if (record.getSenderTelephone() != null) {
                    VALUES("sender_telephone", "#{senderTelephone,jdbcType=VARCHAR}");
                }

                if (record.getProvince() != null) {
                    VALUES("province", "#{province,jdbcType=VARCHAR}");
                }

                if (record.getCity() != null) {
                    VALUES("city", "#{city,jdbcType=VARCHAR}");
                }

                if (record.getDistrict() != null) {
                    VALUES("district", "#{district,jdbcType=VARCHAR}");
                }

                if (record.getSenderAddress() != null) {
                    VALUES("sender_address", "#{senderAddress,jdbcType=VARCHAR}");
                }

                if (record.getCreateTime() != null) {
                    VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
                }

                if (record.getIsDefault() != null) {
                    VALUES("is_default", "#{isDefault,jdbcType=INTEGER}");
                }

                if (record.getState() != null) {
                    VALUES("state", "#{state,jdbcType=INTEGER}");
                }

            }
        }.toString();
    }

    /* @mbggenerated */
    public String updateByPrimaryKeySelective(DeliverySender record) {
        return new SQL() {
            {
                UPDATE("delivery_sender");

                if (record.getUserId() != null) {
                    SET("user_id = #{userId,jdbcType=INTEGER}");
                }

                if (record.getSenderName() != null) {
                    SET("sender_name = #{senderName,jdbcType=VARCHAR}");
                }

                if (record.getSenderTelephone() != null) {
                    SET("sender_telephone = #{senderTelephone,jdbcType=VARCHAR}");
                }

                if (record.getProvince() != null) {
                    SET("province = #{province,jdbcType=VARCHAR}");
                }

                if (record.getCity() != null) {
                    SET("city = #{city,jdbcType=VARCHAR}");
                }

                if (record.getDistrict() != null) {
                    SET("district = #{district,jdbcType=VARCHAR}");
                }

                if (record.getSenderAddress() != null) {
                    SET("sender_address = #{senderAddress,jdbcType=VARCHAR}");
                }

                if (record.getCreateTime() != null) {
                    SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
                }

                if (record.getIsDefault() != null) {
                    SET("is_default = #{isDefault,jdbcType=INTEGER}");
                }

                if (record.getState() != null) {
                    SET("state = #{state,jdbcType=INTEGER}");
                }

                WHERE("id = #{id,jdbcType=INTEGER}");

            }
        }.toString();
    }
}